//
//  StarPhoneViewController.m
//  StarPhone
//
//  Created by sxsk on 2025/2/17.
//

#import "StarPhoneViewController.h"

@interface StarPhoneViewController ()
@property (nonatomic, copy) NSString *numberString;
@end

@implementation StarPhoneViewController

- (IBAction)deleteBtn:(UIButton *)sender {
    self.numberString = @"";
}

- (IBAction)oneBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"1"];
}


- (IBAction)twoBtn:(UIButton *)sender {
    
    self.numberString = [self.numberString stringByAppendingString:@"2"];
    
}

- (IBAction)three:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"3"];
}

- (IBAction)fourBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"4"];
}

- (IBAction)fiveBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"5"];
}


- (IBAction)sixBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"6"];
}

- (IBAction)sevenBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"7"];
}

- (IBAction)eightBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"8"];
}

- (IBAction)nineBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"9"];
}

- (IBAction)zeroBtn:(UIButton *)sender {
    self.numberString = [self.numberString stringByAppendingString:@"0"];
}


- (IBAction)nocallBtn:(UIButton *)sender {
    
}

- (IBAction)callBtn:(UIButton *)sender {
    NSMutableString *phone = [NSMutableString stringWithFormat:@"tel:%@",self.numberString];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phone]];
}




- (BOOL)hideNavigationBar {
    return true;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.numberString = @"";
    // Do any additional setup after loading the view from its nib.
}


- (void)setNumberString:(NSString *)numberString {
    _numberString = numberString;
    self.numberLabel.text = numberString;
    if ([numberString isEqualToString: @"" ]) {
        self.deleteBtn.hidden = true;
    } else {
        self.deleteBtn.hidden = false;
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
